<?php
/**
 * Created by PhpStorm.
 * User: zd
 * Date: 2019/1/15
 * Time: 10:04
 */

namespace app\api\validate;


class UserParameter extends BaseValidate
{
    protected $rule=[
        'id'=>'isPositiveInt',
        'send_massage'=>'isPositiveInt',
        'phone'=>'length:1,11',
        'gender'=>'checkGender',
    ];

    protected $message=[
        'id'=>'ID必须为整数',
        'send_massage'=>'ID必须为整数',
        'phone'=>'电话格式不正确',
        'gender'=>'性别格式不正确'
    ];

    public function checkGender($value){
        if ($value == 0 || $value == 1 || $value == 2){
            return true;
        }
        return false;
    }
}